<template>
  <div class="app-container">
    <h4 class="h4" style="font-weight: bold">基本信息</h4>
    <el-form ref="form" :model="form" label-width="80px">
      <el-row>
        <el-col :span="2">
          <img :src="form.headUrl" alt="" style="width: 60px;height: 60px;border-radius: 50%;background: #f5f5f5;">
        </el-col>
        <el-col :span="21" >
          <el-row style="margin-bottom: 20px">
            <el-col :span="6">
              <span>用户ID：{{ form.userId }}</span>
            </el-col>
            <el-col :span="6">
              <span>用户名：{{ form.username }}</span>
            </el-col>
            <el-col :span="6">
              <span>注册日期：{{ parseTime(form.registerDate) }}</span>
            </el-col>
            <el-col :span="6">
              <span>用户类型：{{ form.userType }}</span>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <span>来源渠道：{{ form.source }}</span>
            </el-col>
            <el-col :span="6">
              <span>登录方式：{{ form.loginType }}</span>
            </el-col>
            <el-col :span="6">
              <span>最后登录：{{ parseTime(form.lastLoginDate) }}</span>
            </el-col>
          </el-row>
        </el-col>
      </el-row>
    </el-form>
    <h4 class="label h4" style="font-weight: bold">订单信息</h4>
    <el-row style="margin-bottom: 20px">
      <el-col :span="6">
        <span>订单号：{{ content.orderNum }}</span>
      </el-col>
      <el-col :span="6">
        <span>支付金额：￥{{ content.payAmount }}</span>
      </el-col>
      <el-col :span="6">
        <span>购买类型：{{ content.payType }}</span>
      </el-col>
    </el-row>
    <el-row style="margin-bottom: 20px">
      <el-col :span="6">
        <span>支付方式：{{ content.payType }}</span>
      </el-col>
      <el-col :span="6">
        <span>有效期：{{ content.validityPeriod }}</span>
      </el-col>
      <el-col :span="6">
        <span>是否到期：{{ content.expire }}</span>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="6">
        <span>充值时间：{{ content.payDate }}</span>
      </el-col>
      <el-col :span="6">
        <span>到期时间：{{ content.expireDate }}</span>
      </el-col>
    </el-row>

    <el-form label-width="100px">
      <el-form-item style="text-align: center;margin-left:-120px;margin-top:30px;">
        <el-button @click="close()">返回</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { getUserOrderDetail } from "@/api/shuiyin/shuiyin";

export default {
  name: "OrderDetail",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 角色信息
      list: [],
      // 用户信息
      form: {},
      // 订单信息
      content: {}
    };
  },
  created() {
    const orderId = this.$route.params && this.$route.params.orderId;
    if (orderId) {
      this.loading = true;
      getUserOrderDetail(orderId).then((response) => {
        this.form = response.data.userInfo;
        this.content = response.data;
        this.loading = false;
      });
    }
  },
  methods: {
    /** 单击选中行数据 */
    clickRow(row) {
      this.$refs.table.toggleRowSelection(row);
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.roleIds = selection.map((item) => item.roleId);
    },
    // 保存选中的数据编号
    getRowKey(row) {
      return row.roleId;
    },
    /** 关闭按钮 */
    close() {
      this.$store.dispatch("tagsView/delView", this.$route);
      this.$router.push({ path: "/userMemberOrder" });
    },
  },
};
</script>
